A virtual machine (VM) is a software implementation that enables logic code to be executed on top of the VM as if interfacing with a physical machine (e.g., a host hardware or computing system). Thus, a VM may provide a platform which supports the execution of logic code such as an operating system (OS) or be designed to support the execution of a particular software program. A program running on top of a VM may be also referred to as a guest. A guest program generally is given limited access to the physical machine resources as managed by the VM and a hypervisor.
A hypervisor is a software or firmware layer generally implemented over the physical machine to monitor one or more VMs hosted on the underlying hardware. The hypervisor is often implemented as a standalone software program that executes on the host hardware and provides virtualization for a guest program or OS running on top of a VM. Typically, a hypervisor controls the interactions between the guest programs running in the VM and the physical resources of the host hardware.
Certain events and interactions in a virtualized computing environment may result in the generation of signals referred to as interrupts, which may be communicated to the hypervisor to indicate that an event has occurred that needs to be handled by the hypervisor. Such an event may be caused by a guest program hosted by a VM running on top of the hypervisor, when the guest performs a sensitive instruction or by a device serviced by the guest program, for example.
Interrupts may be classified into two types. Hardware generated interrupts cause a processor (CPU) in a computing system to save the state of execution of a currently running program and to begin execution of another program (i.e., an interrupt handler) to handle the interrupt. Software generated interrupts are usually implemented as instructions, which cause a context switch in the CPU so that an interrupt handler can handle the interrupt.
A hardware interrupt generates a transition to the hypervisor context for handling. One or more transitions are handled synchronously by the hypervisor while the guest is temporarily paused. The hypervisor resumes the guest after handling the interrupts. As such, interrupt handling in a virtualized environment is associated with a relatively high level of overhead, due to the requirements for switching between execution contexts and the memory space used for saving the state of the execution, etc.
I/O intensive applications suffer the maximum virtualization penalty, if the generated hardware interrupts result in many transitions and switches between execution contexts at the hypervisor level or the guest level. As per prior art, the hypervisor configures the mode of operation to cause a transition to the hypervisor when a hardware interrupt arrives in guest mode. The virtualization penalties may be attributed to the overhead associated with switching between the guest and the hypervisor contexts, the CPU cache becoming polluted with data for two different contexts, and the execution delay due to the hypervisor having to handle the interrupts while the guest is in a paused state.